﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CubicFWNet.Data.Models;
using CubicFWNet.Data.ViewModal;

namespace CubicFWNet.Data.SystemManager
{
    public class TechnologyItemRepository : RepositoryBase<TechnologyItem>
    {
        public List<ProductTechnologyView> GetTechnologyItems(Guid tId)
        {
            var result = from tItem in dbcontext.TechnologyItems
                         join pro in dbcontext.Products
                         on tItem.MaterialId equals pro.Id
                         where (tItem.TechnologyId == tId)
                         select new ProductTechnologyView
                         {
                             ProductName = pro.Name,
                             ProductId = pro.Id,
                             Amount = tItem.Amount,
                             Count = tItem.Count,
                             Price = pro.Price
                         };
            return result.ToList();
        }
    }
}
